package com.umeox.moto.watch.fitness.utils;

import com.tencent.mmkv.MMKV;

public class CacheImpl implements ICache {

    private CacheImpl() {

    }

    @Override
    public void put(String key, long value) {
        MMKV.defaultMMKV().putLong(key, value);
    }

    @Override
    public long get(String key, long defaultValue) {
        return MMKV.defaultMMKV().getLong(key, defaultValue);
    }

    @Override
    public void put(String key, int value) {
        MMKV.defaultMMKV().putInt(key, value);
    }

    @Override
    public int get(String key, int defaultValue) {
        return MMKV.defaultMMKV().getInt(key, defaultValue);
    }

    @Override
    public void put(String key, boolean value) {
        MMKV.defaultMMKV().putBoolean(key,value);
    }

    @Override
    public boolean get(String key, boolean defaultValue) {
        return MMKV.defaultMMKV().getBoolean(key,defaultValue);
    }

    @Override
    public void remove(String key) {
        MMKV.defaultMMKV().remove(key);
    }

    @Override
    public void clear() {

    }

    @Override
    public void clearAll() {
        MMKV.defaultMMKV().clearAll();
    }

    public static ICache getInstance() {
        return InstanceHolder.instance;
    }

    private static class InstanceHolder {
        private static final CacheImpl instance = new CacheImpl();
    }
}
